package com.salestax.core;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class ShoppingList {
	
	List<Product> products = new ArrayList<Product>();
	
	public BigDecimal totalCost(){
		BigDecimal total = new BigDecimal(0);
		for(Product product:products){
			total = total.add(product.getTotalPrice());
		}
		return total;	
	}
	
	public BigDecimal totalTax(){
		BigDecimal total = new BigDecimal(0);
		for(Product product:products){
			total = total.add(product.getContributingTax());
		}
		return total;	
	}
	
	public ShoppingList addProduct(Product product){
		products.add(product);
		return this;
	}
	
	public List<Product> getProducts(){
		return products;
	}
	

}
